/**
 * auth: zhukaijun
 * date: 2022-9-2
 * des: sse handler
 */
export const doSse = (path, data, cb) => {
    if ('EventSource' in window) {
        let sse = new EventSource(path + data.data.code);
        sse.addEventListener('0', function (event) {
            // list.push(event.data);
            if (list.length <= 1) {
            } else {
                sse.close();
            }
        }, false);
        // 绑定失败
        sse.addEventListener('1', function (event) {
            cb(0)
        }, false);
    } else {
        return 0;
    }
}